import Mock from "mockjs";
const todayData = {
	attendCount: Mock.mock("@integer(0, 50)"),
	activityIncome: Mock.mock("@integer(1000, 50000)").toFixed(2),
	courseIncome: Mock.mock("@integer(1000, 50000)").toFixed(2),
	orderNum: Mock.mock("@integer(0, 50)"),
};

let createMoneyData = function (length = 10) {
	let y = [];
	for (let i = 0; i < length; i++) {
		y.push(Mock.mock("@integer(1000, 25000)"));
	}
	return {
		dataY: y,
	};
};

let createStudentInfo = function () {
	let list = [];
	for (let i = 0; i < 150; i++) {
		list.push({
			name: Mock.mock("@cname()"),
			phone: "13899897679",
			consumption: Mock.mock("@float(200, 20000)").toFixed(2),
			level: Mock.mock("@integer(0, 3)"),
		});
	}
	return { list };
};
let createSubjectData = function () {
	let list = [];
	for (let i = 0; i < 10; i++) {
		list.push({
			imgSrc: require("../assets/images/home/main-kecheng1.png"),
			name: "幼儿英语入门课程",
			teacher: Mock.mock("@cname()"),
			price: Mock.mock("@float(200, 5000)").toFixed(2),
		});
	}
	return list;
};
let createTeacherData = function () {
	let list = [];
	for (let i = 0; i < 10; i++) {
		list.push({
			avatar: require("../assets/images/home/main-jiaoshi.png"),
			name: Mock.mock("@last()"),
			des: "英语外教",
			uploader: Mock.mock("@last()"),
		});
	}
	return list;
};
let createNews = function () {
	let list = [];
	for (let i = 0; i < 10; i++) {
		list.push({
			avatar: require("../assets/images/home/main-jiaoyutoutiao.png"),
			title: Mock.mock("@csentence(5, 10)"),
			des: Mock.mock("@csentence(5, 10)"),
		});
	}
	return list;
};
export default {
	getTodayData(params) {
		return {
			code: 200,
			msg: "请求today数据成功",
			success: 0,
			data: todayData,
		};
	},
	getMoneyData(params) {
		return {
			code: 200,
			msg: "请求财务数据成功",
			success: 0,
			data: createMoneyData(),
		};
	},
	getStudentInfo(params) {
		return {
			code: 200,
			msg: "请求学生数据成功",
			success: 0,
			data: createStudentInfo(),
		};
	},
	getOrderData(params) {
		return {
			code: 200,
			msg: "请求订单数据成功",
			success: 0,
			data: {
				waitPayCount: Mock.mock("@integer(0, 50)"),
				waitConfirmCount: Mock.mock("@integer(0, 50)"),
				waitBackCount: Mock.mock("@integer(0, 50)"),
			},
		};
	},
	getSubjectData(params) {
		return {
			code: 200,
			msg: "请求课程信息成功",
			success: 0,
			data: createSubjectData(),
		};
	},
	getTeacherData(params) {
		return {
			code: 200,
			msg: "请求教师信息成功",
			success: 0,
			data: createTeacherData(),
		};
	},
	getNews(params) {
		return {
			code: 200,
			msg: "请求新闻成功",
			success: 0,
			data: createNews(),
		};
	},
};
